<script setup lang="ts">
import { usePostStore } from '@/store/post';

const store = usePostStore();

interface Tree {
  label: string
  children?: Tree[]
}

const defaultProps = {
  children: 'children',
  label: 'label',
}
const handleNodeClick = (data: Tree) => {
  console.log(data)
}
</script>

<template>
  <el-card header="模型信息" shadow="never" class="card">
    <el-scrollbar height="100%">
      <el-tree
        :data="store.modelData"
        :props="defaultProps"
        default-expand-all
        @node-click="handleNodeClick"
      />
    </el-scrollbar>
  </el-card>
</template>

<style scoped lang="scss">
.card {
  flex: 1 1 auto;
  :deep(.el-card__body) {
    padding-right: 4px;
    padding-left: 4px;
    height: calc(100% - 48px);
  }
}
</style>